#ifndef VXMOUSETRANSMITTER_H
#define VXMOUSETRANSMITTER_H

#include <Qt>
#include <QtGui>

class VxMouseTransmitter : public QObject
{

	Q_OBJECT

public:

	static VxMouseTransmitter * instance();


	QMouseEvent * event() const { return _event; };
	QObject * sender() const { return _sender; };
	QPoint globalPos() const { return _globalPos; };
	QPoint movedPos() const { return _movedPos; };

	bool pressed();

protected:
	bool eventFilter(QObject *, QEvent *);

private:
	static VxMouseTransmitter * _instance;
	VxMouseTransmitter();

	bool _pressed;

	QMouseEvent * _event;
	QObject * _sender;
	QPoint _globalPos;
	QPoint _movedPos;

	void _buildStateMachine();

	struct MouseTrackPoint{
		QPoint point;
		int time;
	};

	QVector<MouseTrackPoint> _mouseTrack;
	void _checkMomentum();
	QTime _momentumt;

private slots:
	void _mouseReleasedMove();

signals:
	void mousePressed(QMouseEvent * event);
	void mouseReleased(QMouseEvent * event);
	void mousePressedMove(QPoint globalPos);
	void mouseReleasedMove(QPoint globalPos);
	void mousePressedIdle();
	void mouseReleasedIdle(QPoint globalPos);
	void mouseMomentum(QPoint, qreal);

};

#endif // VXMOUSETRANSMITTER_H
